<?php
	$target_url = Utility::currentUrl();
?>
<div class="art-post">
    <div class="art-post-tl"></div>
    <div class="art-post-tr"></div>
    <div class="art-post-bl"></div>
    <div class="art-post-br"></div>
    <div class="art-post-tc"></div>
    <div class="art-post-bc"></div>
    <div class="art-post-cl"></div>
    <div class="art-post-cr"></div>
    <div class="art-post-cc"></div>
    <div class="art-post-body">
        <div class="art-post-inner art-article">
            <!-- begin -->
            <h2 class="art-postheader">[<?php echo ($action == 'add')?"Thêm nhân viên":"Sửa thông tin"; ?>]</h2>
            <?php
    if(isset($errors))
    {
        foreach($errors as $err)
        {
            ?>
            <span class="error-notification">* <?php echo $err; ?></span><br/>
            <?php
        }
    }
    if(isset($message))
    {
        ?>
            <span class="message-notification">* <?php echo $message; ?></span><br/>
            <?php
    }
    echo "<br /><br/>";
            ?>

            <form action="<?php echo $target_url; ?>" method="POST">
                <?php
                if($action == 'edit')
                    echo "<input type='hidden' name='id' value='" . $id . "' />";
                ?>
                <table class="tbl-form">
                    <tbody>
                    <tr>
                        <td>Tên nhân viên</td>
                        <td><input type="text" name="name"
                                   value="<?php if(isset($input)) echo $input->name; ?>"/>
                        </td>
                    </tr>
                    <tr>
                        <td>Ảnh đại diện</td>
                        <td><input type="text" name="image"
                                   value="<?php if(isset($input)) echo $input->image; ?>"/><br />
                            <input
                                type="button" value="thêm ảnh"
                                onclick="window.open('<?php echo Utility::getSiteUrl(); ?>/upload ','Upload','menubar=no,width=800,height=500,toolbar=no')"/>
                        </td>
                    </tr>
                    <tr>
                        <td>Chi tiết</td>
                        <td>
                            <textarea rows="5" cols="50" name="detail" id="detail"
                                      class="form-textarea"><?php  if(isset($input)) echo $input->
                                detail;?></textarea>
                        </td>
                    </tr>
                    <script type="text/javascript">
                        CKEDITOR.replace('detail');
                    </script>
                    <tr>
                        <td>Album ảnh</td>
                        <td>
                            <select name="album_id">
                                <option value="0">Chọn album ảnh của nhân viên</option>
                                <?php
                                foreach($album_list as $album)
                                {
                                    ?>
                                <option value="<?php echo $album->id;?>"><?php echo $album->name; ?></option>
                                    <?php
                                }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>
                            <input type="submit" name="submit" value="<?php echo ($action=='add')?" Thêm":"Sửa"; ?>" />
                            <input type="reset" value="Nhập lại"/>
                            <input type="button" value="Quay lại danh sách"
                                   onclick="window.location='<?php echo Utility::getSiteUrl();?>/agents'"/>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
            <!-- end -->
        </div>

        <div class="cleared"></div>
    </div>
</div>